package com.sca.order.utils;

import com.google.common.collect.Lists;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author liuxianfei
 * @since 2020/11/10 10:18
 */
@Component
public class EnvUtil {

    private final Environment env;

    public EnvUtil(Environment env) {
        this.env = env;
    }

    public boolean isDev() {
        List<String> profiles = Lists.newArrayList(env.getActiveProfiles());
        return profiles.contains("dev");
    }

    public boolean isProd() {
        List<String> profiles = Lists.newArrayList(env.getActiveProfiles());
        return profiles.contains("prod");
    }

}
